Anyone using the KM_Axis, the WaitforMotionComplete was not upadated from 4.28x to 4.28, you can use this code::
public bool WaitforMotionComplete(int timeout)
{
try
{
Stopwatch sw = new Stopwatch();
string value = "";
bool success = false;
int val = -1;
bool istimedout = false;
sw.Start();
while (val != 1)
{
value = _Controller.WriteLineReadLine(String.Format("CheckDone{0}", _ID));
success = Int32.TryParse(value, out val);
if (!success)
{
throw new Exception(String.Format("Bad return value for [CheckDone] function in axis {0} :: value = {1}", _Name, val));
}
if (timeout >= 0)//Determines whether or not to check for a timeout condition
{
if (timeout < sw.ElapsedMilliseconds)
{
istimedout = true;
break;
}
}
Thread.Sleep(30); //This should be optimized to make sure we do not clog USB traffic
}
return val == 1 & !istimedout;
}
catch (Exception ex)
{
throw new Exception(String.Format("Problem checking if axis is done [{0}]", _Name), ex);
}
}
-Brad Murry
|